# _*_ coding:utf-8 _*_
# @author : Joyamon
# @time : 2023-1-10 11:09
# @file : set_win_title.py
import os
from settings.settings import Route


def set_windows_title(new_title):
    """
    设置浏览器标签名称
    """
    report_title = str(Route().allure_results()) + os.path.join(r'\report\index.html')
    with open(report_title, 'r+', encoding='utf-8') as fp:
        all_the_lines = fp.readlines()
        fp.seek(0)
        fp.truncate()
        for line in all_the_lines:
            fp.write(line.replace('Allure Report', new_title))
        fp.close()